<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
	<link rel="stylesheet" href="editormd/examples/css/style.css" />
	    <link rel="stylesheet" href="frame/layui/css/layui.css">
    <link rel="stylesheet" href="editormd/css/editormd.css" />
        <link rel="icon" href="img/theme.png">
<body>
<style>
.title-css{
    width: 100%;
    height: 45px;
    border: 1px solid #CCC;
    font-size: 20px;
    padding-left: 15px;
}
</style>
<div id="layout">
            <header>
            <input class="title-css" type="text" placeholder="请在这里输入文章标题"/>
            </header>
            <div id="test-editormd">
                <textarea style="display:none;" class="editormd-html-textarea" id="editormd"></textarea>
				<textarea class="editormd-html-textarea" name="text" id="editormdhtml"></textarea>
            </div>
</div>
<div style="text-align:center;">
<input class="layui-btn layui-btn-normal" type="submit" value="提交" onclick="tijiao()"/>
</div>   
        <script src="editormd/examples/js/jquery.min.js"></script>
        <script src="editormd/editormd.min.js"></script>
        <script type="text/javascript">
			var testEditor;

            $(function() {
                testEditor = editormd("test-editormd", {
                    width   : "90%",
                    height  : 600,
                    syncScrolling : "single",
                    path    : "editormd/lib/",
                    imageUpload : true,
                    imageFormats : ["jpg","jpeg","gif","png","bmp","webp"],
                    imageUploadURL : "imgUpload",
                    emoji :true,
                    saveHTMLToTextarea : true
                });
           
                /*
                // or
                testEditor = editormd({
                    id      : "test-editormd",
                    width   : "90%",
                    height  : 640,
                    path    : "../lib/"
                });
                */
            });
            
            function tijiao(){
            	var htmlco = $("#editormdhtml").val();
            	var title = $(".title-css").val();
            	//alert(htmlco);
            	$.ajax(
            		{data:{'text':htmlco,'title':title},
            		  dataType:'text',
            		  success: function(data){
            		  	alert(data);
            		  },
            		  type:'post',
            		  url:'test2'
            		}
            	);
            }
        </script>
</body>
</html>